import 'package:cbec_app/entity/user_center/coupon_item_entity.dart';
import 'package:cbec_app/utils/logger.dart';

///优惠券列表
class CouponListEntity {
  int? total;
  List<CouponItemEntity?>? list;
  int? pageNum;
  int? pageSize;
  int? size;
  int? startRow;
  int? endRow;
  int? pages;
  int? prePage;
  int? nextPage;
  bool? isFirstPage;
  bool? isLastPage;
  bool? hasPreviousPage;
  bool? hasNextPage;
  int? navigatePages;
  int? navigatepageNums;
  int? navigateFirstPage;
  int? navigateLastPage;

  CouponListEntity(
      {this.total,
      this.list,
      this.pageNum,
      this.pageSize,
      this.size,
      this.startRow,
      this.endRow,
      this.pages,
      this.prePage,
      this.nextPage,
      this.isFirstPage,
      this.isLastPage,
      this.hasPreviousPage,
      this.hasNextPage,
      this.navigatePages,
      this.navigatepageNums,
      this.navigateFirstPage,
      this.navigateLastPage});

  CouponListEntity.fromJson(Map<String, dynamic> json) {
    total = json['total'];
    var newList=json['list'] as List;
    if (json['list'] != null) {
      List<CouponItemEntity> infoList=newList.map((e){
        return CouponItemEntity.fromJson(e);
      }).toList();
      list=infoList;
    }
    pageNum = json['pageNum'];
    pageSize = json['pageSize'];
    size = json['size'];
    startRow = json['startRow'];
    endRow = json['endRow'];
    pages = json['pages'];
    prePage = json['prePage'];
    nextPage = json['nextPage'];
    isFirstPage = json['isFirstPage'];
    isLastPage = json['isLastPage'];
    hasPreviousPage = json['hasPreviousPage'];
    hasNextPage = json['hasNextPage'];
    navigatePages = json['navigatePages'];
    navigatepageNums = json['navigatepageNums'];
    navigateFirstPage = json['navigateFirstPage'];
    navigateLastPage = json['navigateLastPage'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['total'] = total;
    if (list != null) {
      
      data['list'] = list?.map((v) => v?.toJson()).toList();
    }
    data['pageNum'] = pageNum;
    data['pageSize'] = pageSize;
    data['size'] = size;
    data['startRow'] = startRow;
    data['endRow'] = endRow;
    data['pages'] = pages;
    data['prePage'] = prePage;
    data['nextPage'] = nextPage;
    data['isFirstPage'] = isFirstPage;
    data['isLastPage'] = isLastPage;
    data['hasPreviousPage'] = hasPreviousPage;
    data['hasNextPage'] = hasNextPage;
    data['navigatePages'] = navigatePages;
    data['navigatepageNums'] = navigatepageNums;
    data['navigateFirstPage'] = navigateFirstPage;
    data['navigateLastPage'] = navigateLastPage;
    return data;
  }
}
